package com.hugeyurt.config;

import jakarta.servlet.MultipartConfigElement;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import org.springframework.util.unit.DataSize;
import org.springframework.web.multipart.MultipartResolver;
import org.springframework.web.multipart.support.StandardServletMultipartResolver;

//import org.apache.commons.fileupload.servlet.ServletFileUpload;
//import org.springframework.web.multipart.commons.CommonsMultipartResolver;
//@Configuration
public class FileUploadConfig {
/*
    @Bean
    public MultipartConfigElement multipartConfigElement() {
        MultipartConfigFactory factory = new MultipartConfigFactory();

        // 单个文件大小限制
        factory.setMaxFileSize(DataSize.ofMegabytes(10));
        // 总请求大小限制
        factory.setMaxRequestSize(DataSize.ofMegabytes(100));
        // 临时文件存储路径
        factory.setLocation("d:/uploads");

        return factory.createMultipartConfig();
    }

    @Bean
    public MultipartResolver multipartResolver() {
        return new StandardServletMultipartResolver();
    }*/
}